<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
    String callback = request.getParameter("callback");
	String isShow = request.getParameter("isShow") == null ? "" : request.getParameter("isShow");
	String xm_id = request.getParameter("xm_id") == null ? "" : request.getParameter("xm_id");
	String xm_code = request.getParameter("xm_code") == null ? "" : request.getParameter("xm_code");
	String xm_name = request.getParameter("xm_name") == null ? "" : request.getParameter("xm_name");
	Map<String, Object> sessionMap = (Map<String, Object>) session.getAttribute("LOGIN_USER");
	String person_id = String.valueOf(sessionMap.get("id"));
	String person = String.valueOf(sessionMap.get("truename"));
	String id= request.getParameter("id") == null ? "" : request.getParameter("id");
	boolean isAdd = "".equals(id);
    int flag = 0;
    if(!isAdd){
    	flag = 1;
    }
%>
<html>
	<head>
		<title><%=isAdd?"结算项目收款":"编辑结算收款" %></title>
		<script type="text/javascript" src="<%=contextPath %>/public/js/extend.js"></script>
		<style>
			.td1{
				padding-top:10px;
				padding-bottom:5px;
				font-size: 12px;
				background-color: #c0ebd7;
				width:20%;
			}
			.td2{
				padding:5px
			}
		</style>
	<script type="text/javascript">
	
	var submitUrl = '<%=contextPath %>/springMVC/xmFinance/addXMEndInMoney';
		$(function(){
				$('#warranty_value').numberbox('disable',true);
			$('#in_money').numberbox('disable',true);
			  $('#ff').form('load','<%=contextPath %>/springMVC/xm/getEndInMoneyXMById?xm_id=<%=xm_id%>');
			  $('#table').datagrid({
	         	url:contextPath+"/springMVC/xmFinance/listXMEndInMoneyDetail?xm_id=<%=xm_id%>&status=3",
				rownumbers:true,
				fitColumns:true,
				nowrap:false,
				frozenColumns:[[
					//{field:'ck',checkbox:true},
				    {title:'开票id',field:'id',hidden:true}
				]],
				columns:[[
					//{title:'票号',field:'invoice_code',width:200,align:'center',formatter:function(value,rowData,index){
					//	if(isNaN(value)){
					//		return "无";
					//	}
					//	return value;
					//}},
					{title:'发票抬头',field:'invoice_title',width:350,align:'center'},
					{title:'开票额(元)',field:'account_receivable',width:100,align:'center'},
					{title:'进度收款(元)',field:'has_receivable',width:100,align:'center'},
					{title:'结算收款(元)',field:'end_pay',width:100,align:'center'},
					{title:'备注',field:'remark',width:200,align:'center',editor:{
						type:'textarea'
					}}
				]],
				onBeforeLoad:function(){
					$(this).datagrid('rejectChanges');
				},
				onLoadSuccess:function(){
				
				},
				onClickCell:function(rowIndex,field,value){
		
				}
			});
			
		});

	</script>
	</head>
	<body>
		<div style="width: 97%;padding-left:10px">
		<form id="ff">
			<table  style="border-collapse: collapse;" width="100%" border="1px" bordercolor="#0eb83a">
				<tr>
					<td align="right" class="td1" nowrap>项目编号：</td>
					<td class="td2" nowrap>
						<input  id="xm_code" name="xm_code" readOnly value="<%=xm_code%>">
						<input type="hidden" id="xm_id" name="xm_id" readOnly value="<%=xm_id%>">
						
					</td>
					<td align="right" class="td1" nowrap>项目名称：</td>
					<td class="td2" nowrap>
						<input  id="xm_name" name="xm_name" readOnly value="<%=xm_name%>">
					</td>
				</tr>
				<tr>	
					<td align="right" class="td1" nowrap>已开票金额：</td>
					<td class="td2" nowrap>
						<input  id="out_invoice" name="out_invoice" readOnly value=0>
					</td>
					<td align="right" class="td1" nowrap>已收款金额：</td>
					<td class="td2">
						<input  id="has_receivable" name="has_receivable" readOnly value=0>
					</td>
				</tr>
				<tr>
			        <td align="right" class="td1" nowrap>结算应收尾款金额：</td>
					<td class="td2" >
					<input  id="in_money" name="in_money"  class="easyui-numberbox" data-options="min:0,precision:2" value="0" readonly>
					</td>
					<td align="right" class="td1" nowrap>新增管理费用：</td>
					<td class="td2"  >
						<input  id="manage_money" name="manage_money"  class="easyui-numberbox" data-options="min:0,precision:2" value="0">	
						<input type="hidden" id="other_account_receivable" name="other_account_receivable"    value="0">	
					</td>
				</tr>
				<tr>
			        <td align="right" class="td1" nowrap>结算质保金额：</td>
					<td class="td2" >
					<input  id="warranty_value" name="warranty_value"  class="easyui-numberbox" data-options="min:0,precision:2" value="0">
					</td>
					<td align="right" class="td1" nowrap>预警日期：</td>
					<td class="td2" nowrap >
					<input id="alarm_time" name="alarm_time" class="easyui-datebox" />
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap>摘要：</td>
					<td class="td2" nowrap colspan='3'>
						<textarea  id="end_inmoney_remark" name="end_inmoney_remark" rows="6" style="width: 100%"></textarea>
					</td>
				</tr>
				<tr>
					<td colspan="4"  nowrap>
						<div id="table"></div>
					</td>
				</tr>
			</table>
			</form>
		</div>
		
	</body>
</html>